<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../../css/register.css" />
<link rel="stylesheet" type="text/css" href="../../js/jDialog/jDialog.css">
<script type="text/javascript" src="../../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../js/jDialog/jquery.dialog.js"></script>
<script type="text/javascript" src="../../js/form/jquery.form.js"></script>
<title>企业注册</title>
<script type="text/javascript" >
$.checkLogin = function(){
	var companyLoginName=$("#companyDTO\\.companyLoginName").val();
	if(companyLoginName==""){
		$("#tip").html("登录名不能为空");
		$("#tip").css('visibility', 'visible');
		return false;
	}else if($("#companyDTO\\.companyName").val()==""){
		$("#tip").html("公司名称不能为空");
		$("#tip").css('visibility', 'visible');
		return false;
	}else{
		$("#tip").css('visibility', 'hidden');
		return true;
	}
}
$.checkPwd = function(){
	var rightPwd = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
	if($("#companyDTO\\.companyPwd").val() == ""){
		$("#tip").html("密码不能为空");
		$("#tip").css('visibility', 'visible');
		return false;
	}else if(rightPwd.test($("#companyDTO\\.companyPwd").val())==false){
		$("#tip").html("密码由6-20位数字和字母组成");
		$("#tip").css('visibility', 'visible');
		return false;
		//$("#pwdHelp").css('visibility', 'visible');
	}else if($("#companyDTO\\.companyPwd").val()!=$("#surePwd").val()){
		$("#tip").html("密码不一致");
		$("#tip").css('visibility', 'visible');
		return false;
	}else{
		$("#tip").css('visibility', 'hidden');
		return true;
	}
}
$.regsCheck = function(){
	 if($.checkLogin()==true){
		if($.checkPwd()==true){
			var option = {
					type : 'post',
					dataType : 'text',
					url : '../../company/regCheck.action',
					success : function(msg) {
						if(msg == -1){
							$("#tip").html("该用户名已被占用,请重新修改");
							$("#tip").css('visibility', 'visible');
						}else if(msg == -2){
							$("#tip").html("该企业名称已存在");
							$("#tip").css('visibility', 'visible');
						}else if(msg == 0){
							$("#tip").html("系统出错");
							$("#tip").css('visibility', 'visible');
						}else{
							$("#tip").css('visibility', 'hidden');
							var dialog = jDialog.alert('注册成功，请等待管理员审核！',{},{
								showShadow: false,
								buttonAlign : 'center',
								events : {
									show : function(evt){
										var dlg = evt.data.dialog;
									},
									close : function(evt){
										var dlg = evt.data.dialog;
										window.location.href="../../company_login.html";
									},
									enterKey : function(evt){
										alert('enter key pressed!');
									},
									escKey : function(evt){
										evt.data.dialog.close();
									}
								}
							  });
						}
					}
				};
			$("#regForm").ajaxSubmit(option);
		}
	} 
}
</script>
</head>
<body>
<div id="topDiv">
<div class="logo"><img src="../../images/earth-globe.png"/></div><div class="logo1">招聘网</div>
<div class="topLink">
<img id="backHome" alt="返回登录界面" title="返回登录界面" src="../../images/backHome.png" onclick="window.location.href='../../company_login.html'" style="cursor:pointer;"/>
</div>
</div>
<div id="mainContent">
<div class="topTip">
<img src="../../images/cominfo.png"/><span>企业注册</span><br>
<span id="tip" style="visibility:hidden;">提示信息</span>
</div>
<form name="regForm" id="regForm" method="post">
<ul class="nopoint">
<li><label for="companyDTO.companyLoginName">登录名：</label>&nbsp;&nbsp;&nbsp;<input type="text" name="companyDTO.companyLoginName" id="companyDTO.companyLoginName"/></li>
<li><label for="companyDTO.companyName">企业名称：</label><input type="text" name="companyDTO.companyName" id="companyDTO.companyName"/></li>
<li><label for="companyDTO.companyPwd">密码：</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="companyDTO.companyPwd" id="companyDTO.companyPwd"/></li>
<li><label for="surePwd">确认：</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="password" name="surePwd" id="surePwd"/></li>
<li><input type="button" value="注册" onclick="$.regsCheck()"></li>
</ul>
<input type="hidden" value="0" id="companyDTO.companyStatus" name="companyDTO.companyStatus"/>
</form>
</div>
</body>
</html>